import http from '../utils/http.js'

export const apiPostLogin = data => { console.log('用户信息',data);return http.post('/user/login/auto',data)}
// 检查版本的接口
export const version = data => http.get('/user/config/apk/view',data)

// 版本比较函数
export const versionCompare = function (curr, promote) {
    let currVer = curr || '0.0.0';
    let promoteVer = promote || '0.0.0';
    if (currVer === promoteVer) return false;
    let currVerArr = currVer.split('.');
    let promoteVerArr = promoteVer.split('.');
    let len = Math.max(currVerArr.length, promoteVerArr.length);
    let proVal, curVal;
    for (var i = 0; i < len; i++) {
        proVal = ~~promoteVerArr[i];
        curVal = ~~currVerArr[i];
        if (proVal < curVal) {
            return false;
        } else if (proVal > curVal) {
            return true;
        }
    }
    return false;
};
